<div class="box box-solid">
    <div class="box-body table-responsive no-padding">
        <form role="form" action="#" method="post">
            <input type="hidden" name="manager[id]" value="<?php echo $manager['id']; ?>" />
            <div class="box-body">
                    <div class="form-group">
                        <label>用户名</label>
                        <input type="text" name='manager[name]' class="form-control" maxlength="20" value="<?php echo $manager['name']; ?>">
                        <p class="help-blockk"></p>
                    </div>
                    <div class="form-group">
                    <label class="control-label" for="form-field-1">状态:</label>
                    <div class="controls">
                        <select  name='manager[status]'  class="form-control  name">
                            <option <?php if(!empty($manager['status'])&&$manager['status']==1) echo 'selected' ?> value="1">正常</option>
                            <option <?php if(!empty($manager['status'])&&$manager['status']==2) echo 'selected' ?> value="2">禁用</option>
                        </select>
                    </div>
                </div>

               
                <div class="form-group">
                    <label class="control-label" for="form-field-1">权限:</label>
                    <div class="controls">
                        <?php if(!empty($options)) :?>
                            <?php foreach ($options as $key => $value) :?>
                                <label style="color:#f00"><?php echo $key; ?></label>
                                <br/>
                                <?php if(!empty($value) && is_array($value)) : ?>
                                        <?php foreach ($value as $k => $v) :?>
                                            <label style="margin-right:20px;">
                                           <?php echo $v ?><input value="<?php echo $k; ?>" <?php if(!empty($manager['sp'])&&is_array($manager['sp'])&&in_array($k,$manager['sp'])) echo 'checked' ;?> type="checkbox" name="manager[sp][]" />
                                        </label>
                                        <?php endforeach; ?>
                                <?php endif; ?>
                                
                                <br/>
                                    
                            <?php endforeach; ?>
                        <?php endif; ?>
                    </div>
                        <?php if(false): ?>
                    <div class="controls">
                        <?php if(!empty($options)) :?>
                            <?php foreach ($options as $key => $value) :?>
                                <label style="margin-right:20px;">
                                    <?php echo $value ?><input 
                                    <?php if(!empty($manager['sp'])&&is_array($manager['sp'])&&in_array($key,$manager['sp'])) echo 'checked' ;?>
                                    value="<?php echo $key; ?>" type="checkbox" name="manager[sp][]" />
                                </label>
                                    
                            <?php endforeach; ?>
                        <?php endif; ?>
                    </div>
                        <?php endif; ?>
                </div>
                    <div class="box-footer">
                        <button class="btn btn-primary" type="submit">编辑</button>
                        <a href="<?php echo $this->createUrl('manager/index'); ?>">返回管理员列表</a>
                    </div>
            </div>
        </form>
    </div>
</div>
<script>
    $(function(){
        $("input[name='manager[name]']").blur(function(){
            $(this).validate(['required', 'name']);
        });
        $("form").submit(function(){
            validateResult = true;
            $("input[name='manager[name]']").validate(['required', 'name']);
            return validateResult
        })
    })
</script>